package com.erp.servlet;

import com.erp.bean.Commodity;
import com.erp.bean.Entrepot;
import com.erp.bean.Inventory;
import com.erp.service.CommodityService;
import com.erp.service.EntrepotService;
import com.erp.service.InventoryService;
import com.erp.service.impl.CommodityServiceImpl;
import com.erp.service.impl.EntrepotServiceImpl;
import com.erp.service.impl.InventoryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author lyb
 * 创建仓库调度控制器
 */
@WebServlet("/dispatch.action")
public class DispatchServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        EntrepotService entrepotService=new EntrepotServiceImpl();
        List<Entrepot> list=entrepotService.findAll();
        //将仓库列表放入作用域
        req.setAttribute("list",list);

        System.out.println(list);
        //将列表转发到调用页面
        req.getRequestDispatcher("dispatchlist.jsp").forward(req,resp);
    }

    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
